﻿<UserControl x:Class="SourceControlMonitor.Views.RepositoryEditorView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:w="clr-namespace:Infrastructure.Utilities;assembly=Infrastructure" 
             Padding="10"
             mc:Ignorable="d" 
             MinWidth="400">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.Resources>
            <Style TargetType="TextBlock">
                <Setter Property="HorizontalAlignment" Value="Right" />
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="Width" Value="110" />
            </Style>
        </Grid.Resources>

        <TextBlock Text="Type: " ToolTip="The type of the repository"/>
        <!--WPF tip: when binding to an ICollectionView, make sure to set IsSynchronizedWithCurrentItem or stuff.MoveCurrentTo() does not update the View-->
        <ComboBox Grid.Column="1" ItemsSource="{Binding RepositoryServices}" DisplayMemberPath="RepositoryType" IsSynchronizedWithCurrentItem="True" />
        
        <!--Container for dynamically injected repository details views-->
        <ContentControl Grid.Row="1" Grid.ColumnSpan="2" Content="{Binding RepositoryDetailsView}" />

        <StackPanel Grid.Row="2" Margin="0,30,0,0" Grid.ColumnSpan="2" HorizontalAlignment="Right" Orientation="Horizontal" >
            <Button Width="75" Height="25" Content="{Binding AcceptText, FallbackValue=Ok}" Command="{Binding OnOkClick}" Margin="0,0,20,0" />
            <Button Width="75" Height="25" Content="Cancel" Command="{Binding OnCancelClick}" />
        </StackPanel>
    </Grid>
</UserControl>
